package cn.iocoder.yudao.module.datasource.controller.admin.config.vo;

import cn.iocoder.yudao.module.datasource.enums.DataSourceTypeEnum;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

@Schema(description = "管理后台 - 数据源配置新增/修改 Request VO")
@Data
public class DataSourceConfigSaveReqVO {

    @Schema(description = "主键编号", example = "1024")
    private Long id;

    @Schema(description = "数据源名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "主数据库")
    @NotEmpty(message = "数据源名称不能为空")
    private String name;

    @Schema(description = "数据源连接URL", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotEmpty(message = "数据源连接URL不能为空")
    private String url;

    @Schema(description = "用户名", requiredMode = Schema.RequiredMode.REQUIRED, example = "root")
    @NotEmpty(message = "用户名不能为空")
    private String username;

    @Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotEmpty(message = "密码不能为空")
    private String password;

    @Schema(description = "数据库类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "MYSQL")
    @NotEmpty(message = "数据库类型不能为空")
    @InEnum(DataSourceTypeEnum.class)
    private String type;

    @Schema(description = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
    @NotNull(message = "是否启用不能为空")
    private Boolean enabled;

    @Schema(description = "备注", example = "主要数据库连接")
    private String remark;

    @Schema(description = "排序", example = "1")
    private Integer sort;

}